package hcn.protocol.brandnew.dengji.jibendangan;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateAdapter;
import ctd.util.xml.jaxb.DateTimeAdapter;
import hcn.protocol.brandnew.BaseRequest;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;


/**
 * 就诊卡信息新增服务-请求消息 - ODS_02010001
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class SetCardsInfoRequest extends BaseRequest {

    /**
     * 就诊卡信息
     */
    @XmlElement(name = "MedicalCardInfos")
    private MedicalCardInfos medicalCardInfos;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Address {

        /**
         * 地址全称（非结构化）
         */
        @XmlElement(name = "AddressDetail")
        private String addressDetail;
        /**
         * 地址-省（自治区、直辖市）
         */
        @XmlElement(name = "Province")
        private String province;
        /**
         * 地址-市（地区、州）
         */
        @XmlElement(name = "City")
        private String city;
        /**
         * 地址-县（区）
         */
        @XmlElement(name = "County")
        private String county;
        /**
         * 地址-乡（镇、街道办事处）
         */
        @XmlElement(name = "Town")
        private String town;
        /**
         * 地址-村（街、路、弄等）
         */
        @XmlElement(name = "Village")
        private String village;
        /**
         * 地址-门牌号码
         */
        @XmlElement(name = "HouseNumber")
        private String houseNumber;
        /**
         * 邮政编码
         */
        @XmlElement(name = "PostalCode")
        private String postalCode;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Contact {

        /**
         * 联系人与患者的关系代码
         */
        @XmlElement(name = "RelationShipWithPatient")
        private String relationShipWithPatient;
        /**
         * 联系人姓名
         */
        @XmlElement(name = "ContactPerson")
        private String contactPerson;
        /**
         * 联系人电话号码
         */
        @XmlElement(name = "ContactPersonTel")
        private String contactPersonTel;
        @XmlElement(name = "GuardianName")
        private String guardianName;
        @XmlElement(name = "GuardianIdCardType")
        private String guardianIdCardType;
        @XmlElement(name = "GuardianIdCardId")
        private String guardianIdCardId;
        @XmlElement(name = "GuardianMobile")
        private String guardianMobile;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class MedicalCardInfos {

        @XmlElement(name = "IdCardCode")
        @DictionaryMapping(id = "CV02_01_101")
        private String idCardCode;
        @XmlElement(name = "MedicalCardType")
        @DictionaryMapping(id = "rmp.dic.medicalCardType")
        private String medicalCardType;

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 业务系统患者档案类型
         */
        @XmlElement(name = "SourcePatientIdType")
        private String sourcePatientIdType;
        /**
         * 建档机构代码
         */
        @XmlElement(name = "AuthorOrganization")
        private String authorOrganization;
        /**
         * 建档机构名称
         */
        @XmlElement(name = "AuthorOrganizationName")
        private String authorOrganizationName;
        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 医疗保险类别代码
         */
        @XmlElement(name = "MedicalInsuranceCategoryCode")
        private String medicalInsuranceCategoryCode;
        /**
         * 就诊卡号
         */
        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;
        /**
         * 就诊卡的状态
         */
        @XmlElement(name = "MedicalCardStatus")
        private String medicalCardStatus;
        /**
         * 建卡（更新）日期时间
         */
        @XmlElement(name = "EffectiveTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date effectiveTime;
        /**
         * 患者姓名
         */
        @XmlElement(name = "Name")
        private String name;
        /**
         * 性别代码
         */
        @XmlElement(name = "Sex")
        private String sex;
        /**
         * 出生日期
         */
        @XmlElement(name = "BirthDate")
        @XmlJavaTypeAdapter(DateAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
        private Date birthDate;
        /**
         * 婚姻状况代码
         */
        @XmlElement(name = "MaritalStatus")
        private String maritalStatus;
        /**
         * 民族
         */
        @XmlElement(name = "EthnicGroup")
        private String ethnicGroup;
        /**
         * 职业类别代码
         */
        @XmlElement(name = "OccupationCategoryCode")
        private String occupationCategoryCode;
        /**
         * 患者电话号码
         */
        @XmlElement(name = "PatientPhone")
        private String patientPhone;
        /**
         * 工作单位名称
         */
        @XmlElement(name = "WorkUnit")
        private String workUnit;
        /**
         * 工作单位电话号码
         */
        @XmlElement(name = "WorkAddrPhone")
        private String workAddrPhone;
        /**
         * 建卡者代码
         */
        @XmlElement(name = "AuthorId")
        private String authorId;
        /**
         * 建卡者姓名
         */
        @XmlElement(name = "Author")
        private String author;
        /**
         * 地址
         */
        @XmlElement(name = "Address")
        private Address address;
        /**
         * 联系人
         */
        @XmlElement(name = "Contact")
        private Contact contact;
    }

}
